package net.stack;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Hannuota {

    public static void main(String[] args) throws IOException {
        int a;
        String str;
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        System.out.println("请输入盘子数量：");
        str=br.readLine();
        a=Integer.parseInt(str);
        hanoi(a,1,2,3);
    }
    public static void hanoi(int n, int p1,int p2,int p3){
        if (n==1){
            System.out.println("盘子从"+p1+"移动到"+p3);
        }else {
            hanoi(n-1,p1,p3,p2);
            System.out.println("盘子从"+p1+"移动到"+p3);
            hanoi(n-1,p2,p1,p3);
        }
    }
}
/**
 * 234-5+/62-*4*
 * 2,3,4-
 * 2,-1,5
 * 2,4
 * 0.5,6,2-
 * 0.5,4
 * 2,4
 * 8
 *
 * 123+*321-+*
 * 1,5
 * 5,3,2,1-
 *
 *
 *
 *
 * a-b*(c+d)/e ------  前：-a/*b+cde
 *              -------- 后：abcd+*e/-
 *
 * ((a+b)*d)+(e/(f+(a*d)))+c  ------- ++*+abd/e+f*adc
 *                            ------- ab+d*efad*+/+c
 *
 */
